package com.zret.oasys.entity;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 
 * @author L.lawliet 员工实体类
 */
public class Emp {
	/**员工id*/
	private int empid;
	/**员工职位*/
	private String position;
	/** 部门id*/
	private int deptid;
	/** 员工姓名*/
	private String empname;
	/** 性别 */
	private String sex;
	// 入职时间
	private Date hiredate;
	// 薪水
	private double salary;
	// 用户名
	private String username;
	// 密码
	private String password;
	// 人脸启用id
	private int faceflag;
	
	/*********** 实现json转list修改过程 *********************/
	private Dept dept;
	/**
	 * @return the dept
	 */
	public Dept getDept() {
		return dept;
	}
 

	/**
	 * @param dept the dept to set
	 */
	public void setDept(Dept dept) {
		this.dept = dept;
	}
	   private Position pos;
	    
		public Position getPos() {
			return pos;
		}

		public void setPos(Position pos) {
			this.pos = pos;
		}
	/******** 实现json转list修改过程 ***************/

	/**时间格式 这里必须设置静态,不然转为json格式会出现报错*/
	private static SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

	public Emp() {
		// 构造方法
	}

	// 有参构造
	public Emp(int empid, String position, int deptid, String empname, String sex, String hiredate, double salary,
			String username, String password, int faceflag) {
		super();
		this.empid = empid;
		this.position = position;
		this.deptid = deptid;
		this.empname = empname;
		this.sex = sex;
		this.setHiredate(hiredate);
		this.salary = salary;
		this.username = username;
		this.password = password;
		this.faceflag = faceflag;
	}

	// 无员工id的有参构造
	public Emp(String position, int deptid, String empname, String sex, String hiredate, double salary, String username,
			String password, int faceflag) {
		super();
		this.position = position;
		this.deptid = deptid;
		this.empname = empname;
		this.sex = sex;
		this.setHiredate(hiredate);
		this.salary = salary;
		this.username = username;
		this.password = password;
		this.faceflag = faceflag;
	}

	// 无员工id.无人脸启用id的有参构造
	public Emp(String position, int deptid, String empname, String sex, String hiredate, double salary, String username,
			String password) {
		super();
		this.position = position;
		this.deptid = deptid;
		this.empname = empname;
		this.sex = sex;
		this.setHiredate(hiredate);
		this.salary = salary;
		this.username = username;
		this.password = password;
	}
	//无密码构造
	// 无员工id.无人脸启用id的有参构造
		public Emp(String position, int deptid, String empname, String sex, String hiredate, double salary, String username,
				int faceflag) {
			super();
			this.position = position;
			this.deptid = deptid;
			this.empname = empname;
			this.sex = sex;
			this.setHiredate(hiredate);
			this.salary = salary;
			this.username = username;
			this.faceflag = faceflag;
		}
		public Emp(int empid,String position, int deptid, String empname, String sex, String hiredate, double salary, String username,
				int faceflag) {
			super();
			this.empid =empid;
			this.position = position;
			this.deptid = deptid;
			this.empname = empname;
			this.sex = sex;
			this.setHiredate(hiredate);
			this.salary = salary;
			this.username = username;
			this.faceflag = faceflag;
		}
		

	/**
	 * @return the empid 员工id
	 */
	public int getEmpid() {
		return empid;
	}

	/**
	 * @param empid the emp 员工id to set
	 */
	public void setEmpid(int empid) {
		this.empid = empid;
	}

	/**
	 * @return the position 职位
	 */
	public String getPosition() {
		return position;
	}

	/**
	 * @param position the position to set 职位
	 */
	public void setPosition(String position) {
		this.position = position;
	}

	/**
	 * @return the deptid 部门id
	 */
	public int getDeptid() {
		return deptid;
	}

	/**
	 * @param deptid the deptid to set 部门id
	 */
	public void setDeptid(int deptid) {
		this.deptid = deptid;
	}

	/**
	 * @return the empname 员工姓名
	 */
	public String getEmpname() {
		return empname;
	}

	/**
	 * @param empname the empname to set 员工姓名
	 */
	public void setEmpname(String empname) {
		this.empname = empname;
	}

	/**
	 * @return the sex 员工性别
	 */
	public String getSex() {
		return sex;
	}

	/**
	 * @param sex the sex to set 员工性别
	 */
	public void setSex(String sex) {
		this.sex = sex;
	}

	/**
	 * @return the hiredate 入职时间更改为simple格式转字符串
	 */
	public String  getHiredate() {
		return  simple.format(hiredate);
	}

	/**
	 * @param hiredate the hiredate to set 入职时间格式转字符串
	 */
	public void setHiredate(Date hiredate) {
		this.hiredate = hiredate;
	}

	/**
	 * @param hiredate the hiredate to set 入职时间格式转字符串
	 */
	public void setHiredate(String hiredate) {
		try {
			this.hiredate = simple.parse(hiredate);
		} catch (ParseException e) {
			// 异常处理
			e.printStackTrace();
		}
	}

	/**
	 * @return the salary 员工薪水
	 */
	public double getSalary() {
		return salary;
	}

	/**
	 * @param salary the salary to set 员工薪水
	 */
	public void setSalary(double salary) {
		this.salary = salary;
	}

	/**
	 * @return the username 员工账户用户名
	 */
	public String getUsername() {
		return username;
	}

	/**
	 * @param username the username to set 员工账户用户名
	 */
	public void setUsername(String username) {
		this.username = username;
	}

	/**
	 * @return the password 员工账户密码
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * @param password the password to set 员工账户密码
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * @return the faceflag 人脸识别flag
	 */
	public int getFaceflag() {
		return faceflag;
	}

	/**
	 * @param faceflag the faceflag to set 人脸识别flag
	 */
	public void setFaceflag(int faceflag) {
		this.faceflag = faceflag;
	}

	@Override
	/** 员工类toString 方法*/
	public String toString() {
		return "Emp [empid=" + empid + ", position=" + position + ", deptid=" + deptid + ", empname=" + empname
				+ ", sex=" + sex + ", hiredate=" + this.getHiredate() + ", salary=" + salary + ", username=" + username
				+ ", password=" + password + ", faceflag=" + faceflag + "]";
	}

}
